janet -i program.jimage
nc geoguesser.chal.uiuc.tf 1337
Author: richard
Files:jimage seems to have some math rng then we need to guess the answerjanet seems just compiled elf of janet# ./janet -i program.jimage
Welcome to geoguesser!
Where am I? 0.2,0.3
Nope. You have 4 guesses left.
Where am I? 1,1
Nope. You have 3 guesses left.
Where am I? 1,1
Nope. You have 2 guesses left.
Where am I? 0,1
Nope. You have 1 guesses left.
Where am I? 1,0.2
You lose!
The answer was: <tuple 0x5584FD29DBC0># strings program.jimage
root-env
parse-coord
source-map
main.janet
value
parse-coord
main
float
number
some
peg/match
_000031
_000032,
(parse-coord s)
random-float
random-float
math/rng-uniform
(random-float min max)
main
main
Welcome to geoguesser!
print
init-rng
os/time
math/rng
init-rng,
guessing-game
get-guess
Where am I?
prin
stdin
line
file/read
"Not a valid coordinate. Try again.
get-guess
_000033
input-line
_00003w
num,
compare-coord
compare-float
math/abs
tolerance
compare-float,
compare-coord
_00003P,
Nope. You have
guesses left.
answer
guessing-game
guess
remaining
_00004I,
print-flag
flag.txt
file/open
You win!
string/trimr
The flag is:
print-flag
You lose!
The answer was:
(main &)
(init-rng)
*macro-lints*
(compare-float a b tolerance)
(compare-coord a b tolerance)
precision
(guessing-game answer)
*current-file*
source
coordinate-peg
(get-guess)
(print-flag)os/time, so they probably used a seed based on connection time, then (random-float min max) gives 2 valuesjanet binary which is just the janet compiled elfjimage file which are pre-compiled janet programsx.xxx,y.yyy# ./janet -i program.jimage
Welcome to geoguesser!
Where am I? 0.2,0.3
Nope. You have 4 guesses left.
Where am I? 1,1
Nope. You have 3 guesses left.
Where am I? 1,1
Nope. You have 2 guesses left.
Where am I? 0,1
Nope. You have 1 guesses left.
Where am I? 1,0.2
You lose!
The answer was: <tuple 0x5584FD29DBC0> The answer was: <tuple 0x5584FD29DBC0>)(parse-coord s)
random-float
random-float
math/rng-uniform
(random-float min max)
init-rng
os/time
math/rngrng-uniform(math/rng-uniform (math/rng (os/time))) ok this gives a uniform numberrandom-float is their defined function ?random-float??韶math/rng-uniform
?min
?max
?, * ; / * 3 3(defn random-float [lower greater]
(+ (* (math/rng-uniform RNG)
(- greater lower))
lower))
some online scriptmin + rand * (max - min)The answer was: <tuple 0x5584FD29DBC0> to guess(defn random-float [min max rng]
(+ (* (math/rng-uniform rng)
(- max min))
min))
(defn -main []
(let [rng (math/rng (os/time))
num1 (random-float -90 90 rng)
num2 (random-float -180 180 rng)]
(print "Random float 1: " num1 "\n")
(print "Random float 2: " num2 "\n")))
(-main)let [rng (math/rng (os/time)